package com.ssy.lingxi.order.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 平台规则配置
 * @author 万宁
 * @version 2.0.0
 * @date 2021-08-10
 */
@Entity
@Table(schema = "public", name = "ord_base_order_rule", indexes = {@Index(name = "ord_base_order_rule_type_idx", columnList = "ruleType"), @Index(name = "ord_base_order_rule_method_code_idx", columnList = "methodCode"), @Index(name = "ord_base_order_rule_status_idx", columnList = "status")})
public class BaseOrderRuleDO implements Serializable {
    private static final long serialVersionUID = 253933018734485781L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_base_order_rule_seq")
    @SequenceGenerator(sequenceName = "ord_base_order_rule_seq", name = "ord_base_order_rule_seq", allocationSize = 1)
    private Long id;

    /**
     * 规则类型，定义在 PlatformRuleTypeEnum 中
     */
    @Column
    private Integer ruleType;

    /**
     * 规则类型名称
     */
    @Column(columnDefinition = "varchar(200)")
    private String ruleName;

    /**
     * 规则方式枚举，定义在 多个枚举 中，请参考初始化配置
     */
    @Column
    private Integer methodCode;

    /**
     * 规则方式名称
     */
    @Column(columnDefinition = "varchar(200)")
    private String methodName;

    /**
     * 状态，0-停用，1-启用
     */
    @Column
    private Integer status;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getRuleType() {
        return ruleType;
    }

    public void setRuleType(Integer ruleType) {
        this.ruleType = ruleType;
    }

    public String getRuleName() {
        return ruleName;
    }

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    public Integer getMethodCode() {
        return methodCode;
    }

    public void setMethodCode(Integer methodCode) {
        this.methodCode = methodCode;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        BaseOrderRuleDO that = (BaseOrderRuleDO) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
